package com.lab.book.web.controller;

import okhttp3.*;
//import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.io.IOException;
import java.util.HashMap;
import java.util.Map;

@Controller
public class RouterController {
    public static final MediaType JSON = MediaType.parse("application/json; charset=utf-8");
    private OkHttpClient client = new OkHttpClient();

    @GetMapping({"/", "/index.html"})
    public String index() {
        return "index";
    }

    @GetMapping({"/login", "/login.html"})
    public String login() {
        return "login";
    }

    @GetMapping({"/springLogin", "/springLogin.html"})
    public String springLogin() {
        return "springLogin";
    }

    @RequestMapping("/abc")
    @ResponseBody
    public String abc() {
        return "hello world security";
    }

    //@PreAuthorize("hasRole('ROLE_ADMIN')")
    @RequestMapping("/auth123")
    @ResponseBody
    public String authorize() {
        return "有权限访问..................";
    }


}
